<?php
class Zenddn_Plugin_Privileges extends Zend_Controller_Plugin_Abstract{
    
    public function preDispatch(Zend_Controller_Request_Abstract $request){
        $db = Zend_Registry::get('db');
        
        $module = $request->getModuleName();
        $controller = $request->getControllerName();
        $action = $request->getActionName();
        
        $validator = new Zenddn_Validator_ValidatePrivileges($module, $controller, $action);
        
        if($validator->isValid()){
            $data = array('module' => $module, 'controller' => $controller, 'action' => $action);
            
            $db->insert('privileges', $data);
        }
    }
}